import * as THREE from 'three'
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
//实例化一个对象

const loader = new GLTFLoader()
const woman = new THREE.Group()
loader.load(`dragon/scene.gltf`,function (gltf){
    gltf.scene.scale.set(2.1,2.1,2.1);
    gltf.scene.rotateY(-Math.PI/2);
    gltf.scene.position.set(-10,0,0)
    const model = gltf.scene;
    woman.add(model)
    // **创建 AnimationMixer**
    const mixer = new THREE.AnimationMixer(model);

    // **播放第一个动画**
    if (gltf.animations.length > 0) {
        const action = mixer.clipAction(gltf.animations[0]);
        action.play();
    }

    // **在渲染循环中更新动画**
    function animate() {
        requestAnimationFrame(animate);
        mixer.update(0.06); // 调整时间步长
        // renderer.render(scene, camera);
    }
    animate();
})
export default woman;
